package org.zoomdev.zoom.dao.adapters.result;

import org.zoomdev.zoom.dao.adapters.ResultSetAdapter;

import java.sql.Blob;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Blob2BytesResultSetAdapter implements ResultSetAdapter {

    public static final ResultSetAdapter ADAPTER = new Blob2BytesResultSetAdapter();


    public Blob2BytesResultSetAdapter() {

    }

    @Override
    public Object getObject(ResultSet rs, int columnIndex) throws SQLException {
        Blob blob = rs.getBlob(columnIndex);
        return blob.getBytes(1L, (int) blob.length());
    }
}
